@extends('admin.layouts.base')

@section('title','控制面板')

@section('pageHeader','控制面板')

@section('pageDesc','DashBoard')

@section('content')

    
    <div class="row page-title-row" style="margin:5px;">
        <div class="col-md-6">
			<a href="/admin/chart" class="btn btn-success btn-md">
                <i class="fa fa-bar-chart-o"></i> 图形统计模式
            </a>
			<div class="dropdown btn">
			  <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
				选择时间
				<span class="caret"></span>
			  </button>
			  <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
				<li><a href="/admin/table?v=1{!!$domain!!}&t=15">15分钟内</a></li>
				<li><a href="/admin/table?v=1{!!$domain!!}&t=30">30分钟内</a></li>
				<li><a href="/admin/table?v=1{!!$domain!!}&t=60">60分钟内</a></li>
				<li><a href="/admin/table?v=1{!!$domain!!}&t=90">90分钟内</a></li>
				<li><a href="/admin/table?v=1{!!$domain!!}&t=120">2小时内</a></li>
				<li><a href="/admin/table?v=1{!!$domain!!}&t=1440">24小时内</a></li>
				<li><a href="/admin/table?v=1{!!$domain!!}&t=today">今天</a></li>
				<li><a href="/admin/table?v=1{!!$domain!!}">全部</a></li>
			  </ul>
			</div>
			<span>
				5分钟自动<a href="javascript:location.reload();">刷新</a>一次
			</span>
        </div>
        </div>
        <div class="col-md-6 text-right">
			
		</div>

    <div class="row">
        <div class="col-xs-12">
            <div class="box">

                @include('admin.partials.errors')
                @include('admin.partials.success')
                <div class="box-body">
                    <table id="tags-table" class="table table-bordered table-hover">
                        <thead>
                        <tr>
							<th data-sortable="false">统计:{{$tongji}}</th>
                            <th data-sortable="false"><a href="{{$url}}{!!$t!!}&domain=domain">所属域名</a></th>
							<th data-sortable="false"><a href="{{$url}}{!!$t!!}&domain=phone">手机</a></th>
							<th data-sortable="false"><a href="{{$url}}{!!$t!!}&domain=qq">qq</a></th>
							<th data-sortable="false"><a href="{{$url}}{!!$t!!}&domain=email">email</a></th>
							<th data-sortable="false"><a href="{{$url}}{!!$t!!}&domain=wx">微信</a></th>
                            <th data-sortable="false"><a href="{{$url}}{!!$t!!}&domain=query">留言</a></th>
                            <th data-sortable="false"><a href="{{$url}}{!!$t!!}&domain=channel">渠道</a></th>
							<th data-sortable="false"><a href="{{$url}}{!!$t!!}&domain=city">城市</a></th>
							<th data-sortable="false"><a href="{{$url}}{!!$t!!}&domain=title">网页标题</a></th>
							<th data-sortable="false"><a href="{{$url}}{!!$t!!}&domain=name">姓名</a></th>
							<th data-sortable="false"><a href="{{$url}}{!!$t!!}&domain=kfwx">客服微信</a></th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
@stop

@section('js')
    <script>
        $(function () {
            var table = $("#tags-table").DataTable({
                language: {
                    "sProcessing": "处理中...",
                    "sLengthMenu": "显示 _MENU_ 项结果",
                    "sZeroRecords": "没有匹配结果",
                    "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
                    "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
                    "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
                    "sInfoPostFix": "",
                    "sSearch": "搜索:",
                    "sUrl": "",
                    "sEmptyTable": "表中数据为空",
                    "sLoadingRecords": "载入中...",
                    "sInfoThousands": ",",
                    "oPaginate": {
                        "sFirst": "首页",
                        "sPrevious": "上页",
                        "sNext": "下页",
                        "sLast": "末页"
                    },
                    "oAria": {
                        "sSortAscending": ": 以升序排列此列",
                        "sSortDescending": ": 以降序排列此列"
                    }
                },
				"iDisplayLength": 100,
                order: [[0, "desc"]],
                serverSide: true,
                ajax: {
                    url: '/admin/chart/table?v=1{!!$t!!}{!!$domain!!}',
                    type: 'POST',
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                    }
                },
                "columns": [
                    {"data": "domain"},
                    {"data": "domain_count",render:function(data,type,row){ return row['domain_count']+"("+row['domain_bfb']+"%)";}},
                    {"data": "phone_count",render:function(data,type,row){ return data+"("+row['phone_bfb']+"%)";}},
					{"data": "qq_count",render:function(data,type,row){ return data+"("+row['qq_bfb']+"%)";}},
					{"data": "email_count",render:function(data,type,row){ return data+"("+row['email_bfb']+"%)";}},
                    {"data": "wx_count",render:function(data,type,row){ return data+"("+row['wx_bfb']+"%)";}},
                    {"data": "query_count",render:function(data,type,row){ return data+"("+row['query_bfb']+"%)";}},
                    {"data": "channel_count",render:function(data,type,row){ return data+"("+row['channel_bfb']+"%)";}},
					{"data": "city_count",render:function(data,type,row){ return data+"("+row['city_bfb']+"%)";}},
					{"data": "title_count",render:function(data,type,row){ return data+"("+row['title_bfb']+"%)";}},
					{"data": "name_count",render:function(data,type,row){ return data+"("+row['name_bfb']+"%)";}},
					{"data": "kfwx_count",render:function(data,type,row){ return data+"("+row['kfwx_bfb']+"%)";}}
                ],
				
                columnDefs: [
                    {
                       /*  'targets': -1, "render": function (data, type, row)
                        {
							var caozuo = '';
								caozuo += '<a style="margin:3px;" href="/admin/query/' + row['id'] + '/edit" class="X-Small btn-xs text-success "><i class="fa fa-edit"></i> 编辑</a>';
								caozuo += '<a style="margin:3px;" href="#" attr="' + row['id'] + '" class="delBtn X-Small btn-xs text-danger "><i class="fa fa-times-circle-o"></i> 删除</a>';
                            
						   return caozuo;
                        } */
                    },
                    {
                       /*  'targets': 0, "render": function (data, type, row)
                        {
							 var caozuoCB = '';
								caozuoCB += '<div class="checkbox hidden-sm"><label><input class="itemCB" name="itemCB[]" type="checkbox" value="' + row['id'] + '"></label></div>';
                            return caozuoCB;
                        } */
                    }
                ]
            });

            table.on('preXhr.dt', function () {
                loadShow();
            });

            table.on('draw.dt', function () {
                loadFadeOut();
            });

            table.on('order.dt search.dt', function () {
                /* table.column(0, {search: 'applied', order: 'applied'}).nodes().each(function (cell, i) {
                    cell.innerHTML += (i + 1);
                }); */
            }).draw();

            $("table").delegate('.delBtn', 'click', function () {
                var id = $(this).attr('attr');
                $('.deleteForm').attr('action', '/admin/query/' + id);
                $("#modal-delete").modal();
            });
			setTimeout("location.reload()",5*60*1000);
        });
    </script>
@stop